package com.beibei.file.bean;

import java.io.Serializable;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 文件类基类
 * 
 * @author 309814490@qq.com
 * @since 2014-02-12
 */
public class BaseFile implements Serializable {
	private static final long serialVersionUID = 1902813094142357480L;

	private String DEFAULT = "yyyyMMddHHmmssSSS";

	private String clientIp;
	private String className;
	private long startTime;
	private long endTime;

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	public long getStartTime() {
		return startTime;
	}

	public void setStartTime(long startTime) {
		this.startTime = startTime;
	}

	public long getEndTime() {
		return endTime;
	}

	public void setEndTime(long endTime) {
		this.endTime = endTime;
	}

	public long getCount() {
		return endTime - startTime;
	}

	public String getClientIp() {
		return clientIp;
	}

	public void setClientIp(String clientIp) {
		this.clientIp = clientIp;
	}

	public String getServerIp() {
		try {
			return InetAddress.getLocalHost().getHostAddress();
		} catch (UnknownHostException e) {
			e.printStackTrace();
		}
		return "127.0.0.1";
	}

	public String getRandId() {
		return new SimpleDateFormat(DEFAULT).format(new Date());
	}

	public String getValue() {
		return super.toString();
	}

}
